﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PropertyManagement.Business.AbstractService;
using PropertyManagement.DataAccess.Repository;
using PropertyManagement.DataAccess.AbstractRepository;
using Ninject;
using PropertyManagement.Domain.Entity;

namespace PropertyManagement.Business.Service
{
    public class CustomerService : ICustomerService
    {
        ICustomerRepository customerRepository;
        public CustomerService()
        {
            customerRepository = new CustomerRepository();
        }
        //[Inject]
        //public ICustomerRepository CustomerRepository
        //{
        //    get;
        //    set;
        //}

        #region ICustomerService Members

        public bool CreateCustomer(Domain.Entity.Customer customer)
        {
            bool isSuccessfullyAdded = false;
            if (customerRepository.CreateCustomer(customer) > 0)
            {
                isSuccessfullyAdded = true;
            }
            return isSuccessfullyAdded;
        }

        public Customer GetLogInCustomer(Customer customer)
        {
            return customerRepository.GetLogInCustomer(customer);
        }

        public Customer GetLogInCustomerById(long customerId)
        {
            return customerRepository.GetLogInCustomerById(customerId);
        }

        public bool UpdateCustomer(Customer customer)
        {
            bool isSuccesfullyUpdated = false;
            if (customerRepository.UpdateCustomer(customer) > 1)
            {
                isSuccesfullyUpdated = true;
            }
            return isSuccesfullyUpdated;
        }

        #endregion
    }
}
